package com.egao.orderB.controller;

import com.egao.common.core.annotation.ApiPageParam;
import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.results.PageResult2;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.orderB.entity.BillOceanApply;
import com.egao.orderB.service.BillOceanApplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 *
 * 拖车海运报关关联表
 * @author : Doman
 * @date : 2021-09-14 14:07:15
 * @version ：1.0
 */

@Api(tags = "拖车海运报关关联表")
@RestController
@RequestMapping("/api/orderB/billOceanApply")
public class BillOceanApplyController extends BaseController {

	@Autowired
	private BillOceanApplyService billOceanApplyService;

	/**
	 * 分页查询列表
	 */
//	@PreAuthorize("hasAuthority('orderB:billOceanApply:list')")
  @ApiOperation(value ="分页查询拖车海运报关关联表",notes = "" +
    "limit:每页显示几行 必填\n" +
    "page:第几页 必填\n" +
    " \n\n\n" +
    "返回的结果:\n" +
    "id:id\n" +
    "billId:订单id\n" +
    "oceanId:海运id\n" +
    "applyId:报关id\n" +
    "createTime:创建时间\n" +
    "createUser:创建人\n" +
    "updateTime:更新时间\n" +
    "updateUser:更新人\n" +
    "",httpMethod = "POST")
  @ApiPageParam
  @PostMapping("/list")
  public JsonResult page(PageResult2<T> page, BillOceanApply billOceanApply) throws Exception{
    return billOceanApplyService.list(page, billOceanApply, getLoginUser());
  }

  /**
   * 查询全部拖车海运报关关联表
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:list')")
  @ApiOperation("查询全部拖车海运报关关联表")
  @PostMapping("/listAll")
  public JsonResult list(BillOceanApply billOceanApply){
    return billOceanApplyService.list(billOceanApply, getLoginUser());
  }

  /**
   * 设置拖车海运报关三个表的关系
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:list')")
  @ApiOperation(value ="设置拖车海运报关三个表的关系",notes = "" +
          "keywords:bill,ocean,apply 用于查找关联表\n" +
          "billId:订单id\n" +
          "oceanId:海运id\n" +
          "applyId:报关id\n" +
          "",httpMethod = "POST")
  @PostMapping("/setTriAngle")
  public JsonResult setTriAngle(BillOceanApply billOceanApply){
    return billOceanApplyService.setTriAngle(billOceanApply, getLoginUser());
  }

  /**
   * 根据id查询拖车海运报关关联表
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:list')")
  @ApiOperation("根据id查询拖车海运报关关联表")
  @PostMapping("/getTriangleById")
  public JsonResult getTriangleById(BillOceanApply billOceanApply) {
    return billOceanApplyService.getTriangleById(billOceanApply);
  }


  /**
   * 根据id查询拖车海运报关关联表
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:list')")
  @ApiOperation("根据id查询拖车海运报关关联表")
  @PostMapping("/get")
  public JsonResult get(BillOceanApply billOceanApply) {
    return billOceanApplyService.getById(billOceanApply);
  }


  /**
   * 添加拖车海运报关关联表
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:save')")
  @OperLog(value = "拖车海运报关关联表", desc = "添加", param = false, result = true)
  @ApiOperation(value ="添加拖车海运报关关联表",notes = "" +
    "billId:订单id\n" +
    "oceanId:海运id\n" +
    "applyId:报关id\n" +
    "",httpMethod = "POST")
  @PostMapping("/save")
  public JsonResult save(Model model, BillOceanApply billOceanApply) {
    return billOceanApplyService.save(billOceanApply, getLoginUser());
  }

  /**
   * 修改拖车海运报关关联表
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:update')")
  @OperLog(value = "拖车海运报关关联表", desc = "修改", param = false, result = true)
  @ApiOperation(value ="修改拖车海运报关关联表",notes = "" +
    "id:id\n" +
    "billId:订单id\n" +
    "oceanId:海运id\n" +
    "applyId:报关id\n" +
    "",httpMethod = "POST")
  @PostMapping("/update")
  public JsonResult update(Model model, BillOceanApply billOceanApply) {
    return billOceanApplyService.update(billOceanApply, getLoginUser());
  }

  /**
   * 删除拖车海运报关关联表
   */
//  @PreAuthorize("hasAuthority('orderB:billOceanApply:remove')")
  @OperLog(value = "拖车海运报关关联表", desc = "删除", result = true)
  @ApiOperation("删除拖车海运报关关联表")
  @PostMapping("/remove")
  public JsonResult remove(BillOceanApply billOceanApply ) {
    return billOceanApplyService.remove(billOceanApply, getLoginUser());
  }

}
